package mapkit
{
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.events.MouseEvent;
	import flash.geom.Point;

	import mapkit.carto.Location;

	public class MapHandlerEvent extends Event
	{
		public static const IDLE:int=0;
		public static const START:int=1;
		public static const UPDATE:int=2;
		public static const END:int=3;

		public static const LOAD:String="mapHandlerLoad";
		public static const UNLOAD:String="mapHandlerUnload";

		private var _map:Map=null;

		final public function get map():Map
		{
			return _map;
		}

		private var _mevent:MouseEvent=null;

		final public function get relatedMouseEvent():MouseEvent
		{
			return _mevent;
		}

		private var _kevent:KeyboardEvent=null;

		final public function get relatedKeyboardEvent():KeyboardEvent
		{
			return _kevent;
		}

		private var _where:Location=null;

		final public function get where():Location
		{
			return _where;
		}

		public function MapHandlerEvent(type:String, map_:Map, mevent_:MouseEvent=null,
			kevent_:KeyboardEvent=null)
		{
			super(type, true, true);
			_map=map_;
			_mevent=mevent_;
			_kevent=kevent_;
			if (mevent_)
			{
				_where=map_.toMapPoint(new Point(mevent_.stageX - map_.x, mevent_.stageY -
					map_.y));
			}
		}

	}
}